import traceback

def proc_wrap(*args):
    import sys, StringIO
    capture = StringIO.StringIO()
    sys.stderr = sys.stdout = capture
    highlight = args[5]
    planet_list = args[4]
    star_list = args[3]
    moon_list = args[6]
    try:
        exec(args[2])
    except:
        traceback.print_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])
    dataout = {"highlight":highlight, "stdout":capture, "stars": star_list, "planets": planet_list, "moons": moon_list}
    args[0].put(dataout)
